package com.bawei.lib_base

import android.app.Application
import android.content.Context
import androidx.datastore.core.DataStore
import androidx.datastore.preferences.core.Preferences
import androidx.datastore.preferences.preferencesDataStore
import com.alibaba.android.arouter.launcher.ARouter
import com.tencent.mmkv.MMKV

/**
 * 基础App
 */
open class BaseApp : Application() {

    val Context.dataStore: DataStore<Preferences> by preferencesDataStore("video_data_store")

    companion object{
        lateinit var appContext :BaseApp
    }

    override fun onCreate() {
        super.onCreate()
        appContext = this
        if(BuildConfig.DEBUG){
            ARouter.openDebug()
            ARouter.openLog()
        }
        ARouter.init( this)

        MMKV.initialize( this)
    }
}